import React from 'react'
import { Route, Redirect } from 'react-router-dom'
import { isAuth } from '../../helper/auth'
function UserPrivate({ component: Component, ...rest}) {
	return (
		<Route
		{...rest}
		render = {
			props => {
				if (isAuth()) return <Component {...props}/>
				return <Redirect to="/login"/>
			}
		}
		></Route>
	)
}

export default UserPrivate
